package com.app.couponsharelife.data.bean

import android.os.Parcel
import android.os.Parcelable

/**
 *Created by xct on 2019/1/14
 *Description:
 */
data class HomeClassBean(
        var bgImg: String = "",
        var createTime: String = "",
        var favoritesId: String = "",
        var id: Int = 0,
        var images: String = "",
        var name: String = "",
        var sort: Int = 0,
        var type: String = "",
        var value: String = "",
        var keyWord: String = "",
        var isCheck: Boolean=false
) : Parcelable {
    constructor(source: Parcel) : this(
            source.readString()?:"",
            source.readString()?:"",
            source.readString()?:"",
            source.readInt()?:0,
            source.readString()?:"",
            source.readString()?:"",
            source.readInt()?:0,
            source.readString()?:"",
            source.readString()?:"",
            source.readString()?:"",
            1 == source.readInt()
    )

    override fun describeContents() = 0

    override fun writeToParcel(dest: Parcel, flags: Int) = with(dest) {
        writeString(bgImg)
        writeString(createTime)
        writeString(favoritesId)
        writeInt(id)
        writeString(images)
        writeString(name)
        writeInt(sort)
        writeString(type)
        writeString(value)
        writeString(keyWord)
        writeInt((if (isCheck) 1 else 0))
    }

    companion object {
        @JvmField
        val CREATOR: Parcelable.Creator<HomeClassBean> = object : Parcelable.Creator<HomeClassBean> {
            override fun createFromParcel(source: Parcel): HomeClassBean = HomeClassBean(source)
            override fun newArray(size: Int): Array<HomeClassBean?> = arrayOfNulls(size)
        }
    }
}